home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / BULLETIN / 0340A.ZIP / OCOM_SRC.ARC / COM.H < prev    next >
Text File  |  1986-12-28  |  4KB  |  119 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*               The Opus Computer-Based Conversation System                */
  3. /*                          Opus!Comm definitions                           */
  4. /*--------------------------------------------------------------------------*/
  5. #define COM1            0
  6. #define COM2            1
  7.  
  8. #define COM1_BASE       0x3f8
  9. #define COM2_BASE       0x2f8
  10.  
  11. #define COM1_IMR          0x10
  12. #define COM2_IMR          0x08
  13.  
  14. #define PASS_THRU_PORT  0x238
  15.  
  16. #define BITS_7          0x02
  17. #define BITS_8          0x03
  18. #define STOP_1             0x00
  19. #define STOP_2             0x04
  20. #define NO_PARITY       0x00
  21. #define ODD_PARITY      0x08
  22. #define EVEN_PARITY     0x18
  23.  
  24. #define BAUD_110        0x000
  25. #define BAUD_150        0x020
  26. #define BAUD_300        0x040
  27. #define BAUD_600        0x060
  28. #define BAUD_1200       0x080
  29. #define BAUD_2400       0x0A0
  30. #define BAUD_4800       0x0C0
  31. #define BAUD_9600       0x0E0
  32. #define BAUD_19200      0x100
  33. #define BAUD_38400      0x120
  34.  
  35. /* Bit definitions for the Line Status Register */
  36.  
  37. #define DATA_READY         0x0100
  38. #define OVERRUN_ERR         0x0200
  39. #define PARITY_ERR         0x0400
  40. #define FRAMING_ERR         0x0800
  41. #define BREAK_INT             0x1000
  42. #define TX_HOLD_EMPTY     0x2000
  43. #define TX_SHIFT_EMPTY    0x4000
  44.  
  45. /* Bit definitions for the Modem Status Register */
  46.  
  47. #define DELTA_CTS            0x01
  48. #define DELTA_DSR            0x02
  49. #define TRAIL_EDGE_RI    0x04
  50. #define DELTA_CD            0x08
  51. #define CTS                    0x10
  52. #define DSR                    0x20
  53. #define RI                    0x40
  54. #define DCD                    0x80
  55.  
  56. /* Bit definitions for the driver flags */
  57.  
  58. #define USE_XON            0x01
  59. #define USE_CTS            0x02
  60. #define USE_DSR            0x04
  61.  
  62. #define BRK                1
  63. #define MDM                2
  64.  
  65.  
  66. /*--------------------------------------------------------------------------*/
  67. /* MACROS that call the routines in COM_ASM                                 */
  68. /*--------------------------------------------------------------------------*/
  69.  
  70. #define MDM_ENABLE(b)      (_Com_(0x00,b|NO_PARITY|STOP_1|BITS_8))
  71.  
  72. #define MODEM_IN()         (_Com_(0x02)&0x00ff)
  73.  
  74. #define CARRIER            (_Com_(0x03)&DCD)
  75. #define CHAR_AVAIL()       (_Com_(0x03)&DATA_READY)
  76. #define OUT_EMPTY()        (_Com_(0x03)&TX_HOLD_EMPTY)
  77.  
  78. #define MDM_DISABLE()      (_Com_(0x05,BAUD_2400|NO_PARITY|STOP_1|BITS_8))
  79.  
  80. #define DTR_OFF()          (_Com_(0x06,0))
  81. #define DTR_ON()           (_Com_(0x06,1))
  82.  
  83. #define CLEAR_OUTBOUND()   (_Com_(0x09))
  84. #define CLEAR_INBOUND()    (_Com_(0x0a))
  85.  
  86. #define Com_Tx_NW(c)       (_Com_(0x0b,c))
  87. #define PEEKBYTE()         (_Com_(0x0c))
  88.  
  89. #define PAUSE_REQUEST()    (_Com_(0x0f,USE_XON)&USE_XON)
  90. #define XON_ENABLE()       (_Com_(0x0f,USE_XON))
  91. #define XON_DISABLE()      (_Com_(0x0f,0))
  92.  
  93. #define RECVD_BREAK()      (_Com_(0x10,BRK)&BRK)
  94. #define BRK_ENABLE()       (_Com_(0x10,BRK))
  95. #define BRK_DISABLE()      (_Com_(0x10,0))
  96.  
  97. #define MDM_INSTALL(p)     (_Cominit(p))
  98.  
  99. #define OUT_FULL()         (0)      /* stay tuned */
  100.  
  101. #define KEYPRESS()         (_kpress())
  102. #define READKB()           _readkb()
  103. #define READSCAN()         _rdscan()
  104.  
  105. /*--------------------------------------------------------------------------*/
  106. /*                                                                          */
  107. /* A no-stall ReadByte routine might look like this:                        */
  108. /*                                                                          */
  109. /*    int READBYTE()                                                        */
  110. /*       begin                                                              */
  111. /*          return( CHAR_AVAIL() ? MODEM_IN() : (-1) );                     */
  112. /*       end                                                                */
  113. /*                                                                          */
  114. /*--------------------------------------------------------------------------*/
  115.  
  116.  
  117. /* END OF FILE: com.h */
  118.  
  119.